package net.vkits.api;

import net.vkits.admin.domain.model.Content;
import net.vkits.admin.domain.repository.ContentRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by ethan-liu on 2017/1/14.
 */
@Controller
public class ContentsApiController implements ContentsApi {
    @Resource
    private ContentRepository contentRepository;

    @Override
    public ResponseEntity<List<Content>> contentsGet() {
        List<Content> contentList = contentRepository.findAll();
        return new ResponseEntity<>(contentList, HttpStatus.OK);
    }
}
